﻿using IRepositories;
using IRepositories.BASE;
using iService;
using Repositories;
using Service.BASE;
using swiftCode.Bbs.Model.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Service
{
    public class BanRecordService : BaseServices<BanRecord>, IBanRecordService
    {
        //public IBanRecordRepositories dal = new BanRecordRepositories();

        public readonly IBanRecordRepositories dal;
        public BanRecordService(IBanRecordRepositories dalRep) 
        { 
            dal = dalRep;
        }

        public async Task<BanRecord> AddBanUser(BanRecord banRecord, bool autoSave = false)
        {
            return await dal.InsertAsync(banRecord, autoSave);
        }

        public async Task DeleteBanUser(BanRecord banRecord, bool autoSave = false)
        {
            await dal.DeleteAsync(banRecord, autoSave);
        }

        public async Task<List<BanRecord>> GetAllBanUsers()
        {
            return await dal.GetListAsync();
        }

        public async Task<BanRecord> selectBanUser(Expression<Func<BanRecord, bool>> expression)
        {
            return await dal.FindAsyncNoTrack(expression);
        }


    }
}
